/* $Id:special.h $ */
/*
   Copyright (C) 2007 by Jurjen Stellingwerff <jurjen@stwerff.xs4all.nl>
   Part of the Moros Project http://moros.sourceforge.net/

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License version 3.
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY.

   See the COPYING file for more details.
*/

#ifndef __SPECIAL_H
#define __SPECIAL_H

#include <string>
#include <map>
#include <list>
using namespace std;



class special {
    class skill *skill;
    string name;
    string description;
    int type;
    class special *prerequisite;
    string group;
public:
    special();

    // Field : skill
    class skill& getSkill() const;
    void setSkill(class skill &v);

    // Field : name
    const string getName() const;
    void setName(const string v);

    // Field : description
    const string getDescription() const;
    void setDescription(const string v);

    // Field : type
    enum type_enum{type_common,type_uncommon};
    const int getType() const;
    const string showType() const;
    void setType(const int v);
    void setType(const string v);

    // Field : prerequisite
    class special& getPrerequisite() const;
    void setPrerequisite(class special &v);

    // Field : group
    const string getGroup() const;
    void setGroup(const string v);

    void save(class channel &ch);
    void load(class channel &ch);
    void xml(ofstream &f, int l=0, int r=0);
};

// Repository

#define loopSpecials(v) loopMap(special_repo.listSpecial(),v,class special)

class specialRepository {
    map<string,special> specials;
public:
    class special& getSpecial(const string v);
    void setSpecial(class special& v);
    map<string,class special>& listSpecial();
    void delSpecial(const string v);
    const bool isSpecial(const string v) const;
    multimap<string, sigc::signal<void, class special& > > relations;
    bool load(class channel &ch);
    void save(class channel &ch);
};

extern specialRepository special_repo;

#endif // __SPECIAL_H
